<template>
  <div class="Add">
    <el-container>
      <el-header>
        <div style="border-bottom: 1px solid black">
          <h1>管理员添加</h1>
        </div>
      </el-header>
      <el-main>
		<div>
			<div>账号</div>
			<div>
				<el-input v-model="from.account" />
			</div>
		</div>
		<div>
			<div>密码</div>
			<div>
				<el-input v-model="from.password" />
			</div>
		</div>
		<div>
			<div>名字</div>
			<div>
				<el-input v-model="from.nickname" />
			</div>
		</div>
		<div>
			<div>
				电话
			</div>
			<div>
				<el-input v-model="from.phone" />
			</div>
		</div>
		<el-button @click="tianjia()">添加</el-button>
	  </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "Add",
  data(){
	return{
		from:{
			account:'',
			password:'',
			nickname:'',
			phone:'',
		}
	}  
  },
  methods:{
	  tianjia(){
		  console.log(this.from);
		  let fd = new FormData();
		  fd.append("account",this.from.account);
		  fd.append("password",this.from.password);
		  fd.append("nickname",this.from.nickname);
		  fd.append("phone",this.from.phone);
		  this.axios
		  .post("/api/adm/user/addAdm",fd)
		  .then((res) => {
			  console.log(res);
		  }).catch((error)=>{
			  console.log(error);
		  })
	  }
  }
};
</script>

<style scoped></style>
